﻿using Castle.DynamicProxy;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CastleDynamicProxyTest
{
    public class WorkInterceptor : IInterceptor
    {
        public void Intercept(IInvocation invocation)
        {
            //获取执行信息
            var methodName = invocation.Method.Name;

            Console.WriteLine($"{methodName} 准备执行");

            //调用业务方法
            invocation.Proceed();

            //记录日志
            Console.WriteLine($"{methodName} 已执行");
        }
    }
}
